package com.company.test16;

import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

/**
 * Created by Administrator on 2016.8.3.
 */
public class TestKeyboardCode extends JFrame {
    public TestKeyboardCode(){
        JPanel panel=new JPanel();

        panel.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                super.keyPressed(e);

                System.out.println(e.getKeyCode());
            }
        });

        panel.setFocusable(true);

        this.add(panel);
    }
}
